function approve(address spender, uint256 amount) external
returns (bool);
function transferFrom(address sender, address recipient,
uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to,
uint256 value);
event Approval(address indexed owner, address indexed
spender, uint256 value);
}
ERC20 standard code provides the following six functions:
totalSupply function determines the total number of tokens
balance0f shows the balance of the account specified by the
address_owner parameter, where _owner is the address
transfer implements the transfer of tokens from the primary
address to the address of an individual user
transferFrom is used to transfer tokens from one user to
another
approve checks whether the tokens remain in the smart
contract and provides a withdrawal of funds from the account up
to the maximum allowable amount, which is specified as a
parameter of the function
allowance guarantees that there are enough tokens at the
sender’s wallet to transfer them to the recipient
Also, ERC-20 provides for the following two types of events:
transfer – transfer event of tokens between accounts
approval – the event that becomes active upon the successful
execution of the approve function
It’s worth mentioning that the ERC20 token standard has a bug with
its transfer function that we just covered. This bug has burnt the
tokens worth millions of US dollars. With the transfer function, you
can only send the tokens to the recipient’s account. If you use the
“transfer” function, you will see a successful transaction, but the
receiver’s address will never receive the tokens. This burns the